import Vue from 'vue'
import VueRouter from "vue-router";

import Detail from'@/views/article-detail.vue'
import Article from'@/views/article.vue'
import Collect from'@/views/collect.vue'
import Layout from'@/views/layout.vue'
import Like from'@/views/like.vue'
import User from'@/views/user.vue'
Vue.use(VueRouter)


const router = new VueRouter({
  routes: [
// 携带id，请求时就要传一个id
    {path:'/detail/:id',component:Detail},
    // redirect路由重定向，一级路由是layout，它控制页面的四个功能，detail是单独的文章页详情
    {path:'/', redirect:'/article', component:Layout,
  children:[
    {path:'/article',component:Article},
    {path:'/collect',component:Collect},
    {path:'/like',component:Like},
    {path:'/User',component:User},
  ]
  }
  ]
})

export default router